<template>
  <div class="bpl1-bg">
    <div class="co-title">
      <div class="co-title-name">
        <img src="@/assets/cockpit/subdivision/wq-text-cq.png" alt="" />
        <!-- <p class="com-name-style">总体规划</p> -->
      </div>
      <div class="co-title-right">
        <!-- <div class="co-title-select">
          <el-select v-model="value" placeholder="请选择">
            <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option>
          </el-select>
        </div> -->
      </div>
    </div>

    <div class="co-zb-content">
      <div class="zb-content">
        <div class="zb-zx-title">
          城镇开发边界：
          <span class="num">
            3421,55
          </span>
          平方公里
        </div>
        <div class="zb-zx-content">
          <!-- <div class="zx-img" id="boxChart"></div> -->
          <div class="bpr2-chartbox">
            <div class="bpr2-chart-bg"></div>
            <div class="box-chart" id="boxChart"></div>
          </div>
          <!-- <div class="zx-list"></div> -->
        </div>
      </div>
    </div>

    <div class="row-line"></div>

    <ul class="bpl1-stac">
      <li class="bpl1-st-each border-right-line">
        <i class="bpl1-ste-icon"><img src="@/assets/cockpit/subdivision/co-icon-zmj.png" alt=""/></i>
        <div class="bpl1-ste-word">
          <h6>常住人口城镇化率</h6>
          <p>27.35%</p>
        </div>
      </li>
      <li class="bpl1-st-each">
        <i class="bpl1-ste-icon"><img src="@/assets/cockpit/subdivision/co-icon-ghps.png" alt=""/></i>
        <div class="bpl1-ste-word">
          <h6>道路网密度</h6>
          <p>27.65</p>
        </div>
      </li>
      <li class="bpl1-st-each border-right-line">
        <i class="bpl1-ste-icon"><img src="@/assets/cockpit/subdivision/co-icon-zmj.png" alt=""/></i>
        <div class="bpl1-ste-word">
          <h6>绿色交通出行比率</h6>
          <p>27.35%</p>
        </div>
      </li>
      <li class="bpl1-st-each">
        <i class="bpl1-ste-icon"><img src="@/assets/cockpit/subdivision/co-icon-ghps.png" alt=""/></i>
        <div class="bpl1-ste-word">
          <h6 style="margin-top:-8px">轨道站点800米范围<br />人口和岗位覆盖率</h6>
          <p>27.65%</p>
        </div>
      </li>
    </ul>

    <div class="row-line"></div>

    <div class="floorage-area">
      <div class="floorage-tabs">
        <div :class="isActive === 1 ? 'active' : ''" @click="clickActive(1)">建成区面积</div>
        <div :class="isActive === 2 ? 'active' : ''" @click="clickActive(2)">常住人口</div>
      </div>
      <div class="floorage-echart" id="floorage"></div>
    </div>
  </div>
</template>

<script lang="ts">
import { Vue, Component } from 'vue-property-decorator'
import Highcharts from 'highcharts/highstock'

import * as echarts from 'echarts'

@Component({
  name: 'Item1',
  components: {}
})
export default class Item1 extends Vue {
  private isActive = 1
  private options: any = {
    credits: {
      enabled: false
    },
    chart: {
      type: 'pie',
      plotBackgroundColor: null,
      plotBorderWidth: null,
      plotShadow: false,
      backgroundColor: null,
      options3d: {
        enabled: true,
        alpha: 60
      }
    },
    title: {
      text: null
    },
    subtitle: {
      text: null
    },
    plotOptions: {
      pie: {
        size: 110,
        innerSize: 70,
        depth: 20,
        dataLabels: {
          //数据标签
          enabled: false //是否启用
        },
        showInLegend: true
      }
    },
    legend: {
      layout: 'vertical',
      align: 'right',
      // verticalAlign: 'middle',
      floating: true,
      symbolwidth: 6,
      symbolHeight: 6,
      itemStyle: {
        fontSize: '12px',
        color: '#fff',
        fontWeight: 'normal',
        paddingTop: '20px'
      },
      itemHoverStyle: {
        color: '#00EAFF'
      }
    },
    series: [
      {
        name: '占比（%）',
        center: ['24%', '40%'],
        colors: ['#00EAFF', '#6DFFD6', '#FFCF40', '#0095FF', '#00FFAA', '#006AFF'],
        data: [
          ['城镇集中建设区  50%', 50],
          ['城镇弹性发展区  35%', 35],
          ['特别用途区  15%', 15]
        ]
      }
    ]
  }

  clickActive(type: number) {
    this.isActive = type
  }

  mounted() {
    this.initChart()
    this.initFloorage()
  }

  initChart() {
    this.chart = new Highcharts.Chart('boxChart', this.options)
  }

  initFloorage() {
    const myChart = echarts.init(document.getElementById('floorage') as HTMLElement)
    myChart.setOption({
      label: {
        color: '#ffffff'
      },
      grid: {
        top: '4%',
        left: '0%',
        right: '0%',
        bottom: '3%',
        containLabel: true
      },
      xAxis: {
        type: 'category',
        data: ['2013', '2014', '2015', '2016', '2017', '2018', '2019', '2020'],
        //设置网格线颜色
        splitLine: {
          show: false
        },
        axisLine: {
          lineStyle: {
            color: '#254177'
          }
        },

        axisLabel: {
          show: true,
          textStyle: {
            color: '#ffffff', //更改坐标轴文字颜色
            fontSize: 12 //更改坐标轴文字大小
          }
        }
      },
      yAxis: {
        type: 'value',
        axisLabel: {
          show: true,
          textStyle: {
            color: '#00eaff', //更改坐标轴文字颜色
            fontSize: 12 //更改坐标轴文字大小
          }
        },
        splitLine: {
          show: true,
          lineStyle: {
            color: ['#1c3a73'],
            width: 1,
            type: 'solid'
          }
        },
        // y轴轴线颜色
        axisLine: {
          lineStyle: {
            color: '#254177'
            // width: 1 //这里是坐标轴的宽度
          }
        }
      },
      series: [
        {
          data: [8, 7, 3, 14, 16, 19, 10, 8],
          type: 'line',
          smooth: true,
          barWidth: '18%',
          areaStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
              {
                offset: 0,
                color: '#00A3F4'
              },
              {
                offset: 1,
                color: '#00A3F4'
              }
            ])
          },
          itemStyle: {
            color: '#fffff'
          },
          showBackground: true,
          backgroundStyle: {
            color: '#fff'
          }
        }
      ]
    })
  }
}
</script>
<style lang="scss" scoped>
@import '~@/styles/cockpit.scss';
.bpl1-bg {
  width: 100%;
  height: 100%;
  padding: 12px 12px 12px 16px;
  // background: url('~@/assets/cockpit/bpl1-bg.png') no-repeat right center/ 99.3% 100%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  &::before {
    content: '';
    display: block;
    width: 20px;
    height: 103%;
    background: url('~@/assets/cockpit/bpl-bg-line.png') no-repeat 0/ 100% 100%;
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translate(0, -50%);
  }
}
.co-title-select {
  ::v-deep .el-input__inner {
    width: 172px;
    height: 28px;
    background: url('~@/assets/cockpit/co-title-select.png') no-repeat 0/ 100% 100%;
    border: none;
    font-size: 12px !important;
    color: #fff;
  }
  ::v-deep .el-input--small .el-input__icon {
    background: url('~@/assets/cockpit/co-title-select-tri.png') no-repeat 0/ 100% 100%;
    line-height: 28px;
    &::before {
      display: none;
    }
  }
}
.bpl1-table {
  width: 100%;
  .bpl1-tbe {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0px 2px;
    text-align: center;
    .bpl1-tbeh {
      height: 20px;
      background: rgba(#fff, 0.1);
      th {
        font-size: 12px !important;
        line-height: 18px;
        color: #bffeff;
        font-weight: 400;
      }
    }
    .bpl1-tbeb {
      td {
        padding: 4px 4px;
        background: rgba(#fff, 0.05);
        font-size: 16px !important;
        line-height: 20px;
        color: #fff;
        font-weight: 500;
        > span {
          font-size: 12px !important;
          color: #fff;
          font-weight: 400;
        }
      }
      .bpl1-tbeb-title {
        padding: 0 0 0 2px !important;
        background: none;
        border-left: 2px solid #006aff;
        position: relative;
        > p {
          width: 100%;
          height: 100%;
          padding: 4px;
          background: rgba(#fff, 0.05);
          line-height: 20px;
          text-align: center;
          font-size: 12px !important;
          color: #fff;
          font-weight: 400;
        }
      }
    }
  }
}

.co-bz-content {
  font-weight: 500;
  font-size: 12px;
  color: #bffeff;
  .bz-title {
    display: flex;
    justify-content: space-between;
    margin-top: 18px;
    .com-title-style {
      display: flex;
      .title-line {
        width: 40px;
        margin-top: -7px;
        img {
          display: block;
          width: 100%;
        }
      }
    }
  }
  .bz-content {
    display: flex;
    border-right: solid 1px rgba(255, 255, 255, 0.1);
    margin-top: 12px;
    li {
      flex: 1;
      text-align: center;
      height: 64px;
      border-left: solid 1px rgba(255, 255, 255, 0.1);
      .text {
        margin-top: 12px;
      }
      .num {
        font-size: 24px !important;
        color: #fff;
        margin-top: 8px;
        margin-left: -13px;
      }
    }
  }
  .bz-line {
    width: 96%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: auto;
    margin-top: 12px;
  }
}

.co-zb-content {
  margin-top: 16px;
  color: #bffeff;
  .com-title-style {
    display: flex;
    .title-line {
      width: 40px;
      margin-top: -7px;
      img {
        display: block;
        width: 100%;
      }
    }
  }
  .zb-content {
    .zb-zx-title {
      font-weight: 500;
      font-size: 12px;
      color: #dffeff;
      margin-top: -10px;
      .num {
        font-weight: bold;
        font-size: 20px !important;
        color: #fff;
      }
    }
    .zb-zx-content {
      .zx-img {
        width: 90%;
        height: 118px;
        svg {
          width: 100% !important;
          height: 100%;
        }
      }
      .bpr2-chartbox {
        width: 90%;
        height: 122px;
        position: relative;
        margin-top: 14px;
        .box-chart {
          width: 100%;
          height: 100%;
          margin-top: -30px;
        }
        .bpr2-chart-bg {
          width: 172px;
          height: 100px;
          background: url('~@/assets/cockpit/bpr2-chart-bg.png') no-repeat 0/ 100% 100%;
          position: absolute;
          left: 16px;
          top: 30px;
          z-index: -1;
        }
      }
    }
    .zb-zx-title2 {
      font-weight: 500;
      font-size: 14px !important;
      color: #dffeff;
      margin-top: 17px;
      .num {
        font-size: 20px !important;
        color: #fff;
      }
    }
    .co-zb-cylindrical {
      width: 98%;
      height: 300px;
      margin-top: -30px;
    }
  }
}
//
.row-line {
  width: 98%;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 8px auto 0 auto;
}
//
.bpl1-stac {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-left: -16px;
  .border-right-line {
    border-right: solid 1px rgba(255, 255, 255, 0.1);
  }
  .bpl1-st-each {
    flex: none;
    display: flex;
    width: 44%;
    margin-top: 10px;
    .bpl1-ste-icon {
      flex: none;
      width: 64px;
      height: 64px;
      > img {
        display: block;
        width: 100%;
        height: 100%;
      }
    }
    .bpl1-ste-word {
      flex: none;
      > h6 {
        font-size: 12px !important;
        line-height: 18px;
        color: #bffeff;
        text-align: left;
        font-weight: 400;
        margin: 6px 0 0 0;
      }
      > p {
        font-size: 24px !important;
        line-height: 30px;
        color: #fff;
        text-align: left;
        font-weight: 500;
        margin: 4px 0 0 0;
      }
    }
    .bpl1-ste-chart {
      flex: none;
      width: 64px;
      height: 64px;
      padding: 2px;
      position: relative;
      margin: 0 0 0 12px;
      .bpl1-ste-chart-base {
        width: 100%;
        height: 100%;
      }
      .bpl1-ste-chart-word {
        width: 80%;
        position: absolute;
        left: 10%;
        top: 50%;
        transform: translate(0, -50%);
        > h6 {
          font-size: 16px !important;
          text-shadow: 0 0 4px #00ffaa;
          color: #fff;
          line-height: 20px;
          text-align: center;
        }
        > p {
          font-size: 12px !important;
          line-height: 14px;
          color: #bffeff;
          text-align: center;
        }
      }
    }
  }
  .bpl1-st-line {
    flex: none;
    width: 1px;
    height: 64px;
    background: rgba(#fff, 0.1);
    margin: 0 4px;
  }
}

// 建筑面积
.floorage-area {
  width: 100%;
  height: 168px;
  .floorage-tabs {
    font-size: 14px !important;
    text-align: center;
    color: #fff;
    display: flex;
    margin: 15px auto 6px auto;
    .active {
      color: #fff;
      font-weight: 500;
      font-size: 14px !important;
      background: url('~@/assets/cockpit/subdivision/text-bg.png') no-repeat 0/ 100% 100%;
      opacity: 1 !important;
    }
    div {
      width: 85px;
      height: 26px;
      line-height: 26px;
      background: rgba(0, 0, 0, 0.15);
      opacity: 0.7;
      cursor: pointer;
    }
  }
  .floorage-echart {
    width: 100%;
    height: 60%;
  }
}
</style>
